package com.koala.learn.threadlearn.test;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;


/**
 * @Description TODO
 * @Date 2022/3/20 19:33
 * @Created by koala
 */
@Slf4j
@Data
public class Counter implements Runnable {

    private int count;
    private static int MAX = 1000;

    public Counter(int count) {
        this.count = count;
    }

    void add() {
        for (int i = 0; i < MAX; i++) {
            count++;
        }
        log.info("线程{}执行+1  {}", Thread.currentThread().getName(), count);
    }

    @Override
    public void run() {
        add();
    }
}
